import unittest


class TestDemo01(unittest.TestCase):
    def test01(self):
        print('This is test01.')

    @unittest.skip('强制跳过')
    def test02(self):
        print('This is test02.')

    @unittest.skipIf(10 > 9, '强制跳过')
    def test03(self):
        print('This is test03.')

    @unittest.skipUnless(10 < 9, '强制跳过')
    def test04(self):
        print('This is test04.')

    @unittest.expectedFailure
    def test05(self):
        print('This is test05.')


if __name__ == '__main__':
    suite = unittest.TestSuite()
    # 加载测试类
    testCase = unittest.TestLoader().loadTestsFromTestCase(TestDemo01)
    suite.addTest(testCase)
    r = unittest.TestResult()
    suite.run(result=r)
    print(r.__dict__)
